import * as types from "./mutation-types";
import Api from "api/api";
let userChooseTime = sessionStorage.getItem('meet_user_choose_time') || [];
if(userChooseTime.length){
  userChooseTime = JSON.parse(userChooseTime);
}
const state = {
  userChooseTime: userChooseTime // 用户选择的会议时间
};

const getters = {
  userChooseTime: state => state.userChooseTime
};

const actions = {

};

const mutations = {
  [types.UPDATA_USER_CHOOSE_TIME](state, payload) {
    state.userChooseTime = payload;
    sessionStorage.setItem('meet_user_choose_time',JSON.stringify(payload));
  },
  [types.CLEAR_USER_CHOOSE_TIME](state) {
    state.userChooseTime = [];
    sessionStorage.removeItem('meet_user_choose_time')
  }
};

export default {
  state,
  getters,
  actions,
  mutations
};
